<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>布拉泽品牌特卖</title>
    <script>
        (function (window) {
            var ele = document.querySelector('html'),
                screenWidth = window.screen.width;
            if (screenWidth >= 812) {
                ele.style.fontSize = '81.2px'
                return
            }
            ele.style.fontSize = screenWidth / 10 + 'px';
        }(window))
    </script>
    <link rel="stylesheet" href="../style/blz-1023/qcwd/index.css">
</head>

<body>
    <div class="banner"></div>
    <div class="title"></div>
    <div class="container"></div>
    <div class="title"></div>
    <div class="container"></div>
    <div class="title"></div>
    <div class="container"></div>
    <div class="back-top"></div>
    <!-- template -->
    <script type="text/html" id="card-tpl">
        <img src="{{pic}}" alt="">
        <div>
            <p>
                    <i>new</i>
                {{name}}
            </p>
            <div>
                <del>￥{{price_on_tag}}</del>
                &nbsp;
                <span>￥
                    <i>{{discountPrice}}</i>
                </span>
            </div>
        </div>
    </script>
    <script type="text/html" id="ctx-tpl">
        {{each $data}}
        <a class="card C_J_good" href="javascript:;"></a>
        {{/each}}
    </script>
    <script type="text/html" id="img-tpl">
        {{each $data}}
            <img src="../images/blz-1023/{{$value.isPC}}/banner_0{{$index+1}}.jpg" alt="">
        {{/each}}
    </script>
</body>
<script src="../../js/jquery-1.8.3.min.js"></script>
<script src="../../js/art-template.js"></script>
<script src="../../js/login.js"></script>
<script src="../../js/model.js"></script>
<script src="../../js/model-citizen.js"></script>
<script>
    (function ($, template) {
        var SW = window.screen.width;  
        var info = [
            [148604,148570,148568,148621,148565,143247,143231,143246,143249],
            [143388,148627,148599,148593,148573,148574,148580,148600,148751],
            [143120,147721,147611,147722,143313,143289,143309,143083,143181,143129,148750,143192]
        ]

        function getData(id, idx, index) {
            $.ajax({
                url: 'http://www.cjwsc.com/qcwdProduct/getProductByIds',
                data: {
                    ids: id,
                    business_type: SW<960?(SW<810?20:50):10,
                    client_type: SW<960?(SW<810?2:5):1
                },
                dataType: "jsonp",
                jsonp: 'jsonpcallback',
                success: function (res) {
                    var href = 'http://www.cjwsc.com/item/' + id + '.html';
                    res.msg[0].index = idx + 1;
                    res.msg[0].pic = res.msg[0].pic.replace('240_240', '800_800')
                    var element = index ? $('.container').eq(index).find('.card').eq(idx) : $('.card').eq(
                        idx);
                    
                    element.html(template('card-tpl', res.msg[0])).attr(SW<=810?'href':'data-id',SW<=810?href:id);
                    if (res.msg[0].stock_num == 0 || res.msg[0].status == 2) element.addClass('masker')
                        .removeAttr('href');
                }
            })
        }

        function setData(info) {
            for (var i = 0, len = info.length; i < len; i++) {
                $('.container').eq(i).html(template('ctx-tpl', info[i]))
                for (var j = 0, leng = info[i].length; j < leng; j++) {
                    getData(info[i][j], j, i)
                }
            }
        }
        setData(info)

        $('.back-top').on('click', function () {
            $('html,body').animate({
                scrollTop: 0
            }, 500)
        });

        (function(){
            var isPC = SW>=960?'pc':'qcwd';
            var imgArr = [
                {isPC:isPC},
                {isPC:isPC},
                {isPC:isPC}
            ]
            $('.banner').html(template('img-tpl',imgArr))
        }())
        

    })($, template)
</script>

</html>